home *** CD-ROM | disk | FTP | other *** search
- Path: nntp.teleport.com!usenet
- From: GHouck <hksys@teleport.com>
- Newsgroups: comp.lang.c
- Subject: Re: accessing structures (newbie question)
- Date: 21 Feb 1996 08:08:32 GMT
- Organization: systems hk
- Message-ID: <4geju0$sif@maureen.teleport.com>
- References: <4g8gic$o6u@news1.sunbelt.net> <3128FA60.5227@metagen.co.uk> <TANMOY.96Feb19090845@qcd.lanl.gov>
- NNTP-Posting-Host: ip-pdx06-14.teleport.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 1.22 (Windows; I; 32bit)
-
- tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya) wrote:
- [snip]
- >What nonsense! Anything creates trouble if you do not take the time
- >to understand it.
- >
- > I think you may have been using the wrong syntax when you tried the array
- > method. The xth item is given by 'photos[x].' which is equivalent to
- > '(photos + x * sizeof(picture))->'.
- >
- >This is the problem!!! photos[x]. is always the same as (photos + x)->
- >In fact, this is such a basic fact of pointer arithmetic that anyone
- >who posts such nonsense must surely be trying to deliberately mislead
- >newbies. We have enough confusion here: please refrain from posting
- >_answers_ unless you know at least the basics of C!
- >
- Tanmoy,
-
- Speaking of nonsense (your word), what is the meaning of your statement:
-
- > '(photos + x * sizeof(picture))->'. ?
-
- It may make sense conceptually, but syntactically you will step thru
- the array of structures rather quickly (by a factor of sizeof(picture)).
- Unless I'm mistaken, did you not mean:
- > '(photos+x)->' ?
- To use your cordial words: 'We have enough confusion here: please refrain
- from posting _answers_ unless you know at least the basics of C!'
-
- Yours, Geoff Houck
-
-
-